﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using MK.oDataConsuming.ConsoleApp.CarServiceReference;

namespace MK.oDataConsuming.ConsoleApp {
    class Program {
        static void Main(string[] args) {

            Console.WriteLine("Started...");            

            Console.WriteLine("Creating records...");
            DataServiceConnectionController.Create(new Car() { Manufacturer = "Opel", ProductionYear = "2000" });
            DataServiceConnectionController.Create(new Car() { Manufacturer = "Bova", ProductionYear = "2002" });
            DataServiceConnectionController.Create(new Car() { Manufacturer = "VW", ProductionYear = "2012" });

            Console.WriteLine("Retrieving records...");
            List<Car> carList = DataServiceConnectionController.RetrieveMultiple();
            Console.WriteLine("List retrieved");
            foreach (Car c in carList) {
                Console.WriteLine("{0} - {1} - {2}", c.Id, c.Manufacturer, c.ProductionYear);
            }

            Console.WriteLine("Deleting record...");
            DataServiceConnectionController.Delete(carList[1]);

            Console.WriteLine("Finished!");
            Console.Read();
        }
    }
}
